<? //include/SHIPPERS_session.php

include("SHIPPERS.php");

require_once'../include/database.php';
$conn = new Connection();
$conn->NewConnection('localhost','ecommerce','root','batavia');
class SessionSHIPPERS { 


 
 function find($id){
    
   global $conn;
   
   $query = "select ShipperID,CompanyName,Phone from SHIPPERS where ShipperID='$id'";
   
   $run = mysql_query($query) or die(mysql_error());
   
   $row = mysql_fetch_array($run, MYSQL_ASSOC);
   
   $numRow = mysql_numrows($run);
   
   if($numRow)
   
   {
   
   $this->SHIPPERS= new SHIPPERS();


   
	$this->SHIPPERS->setShipperID($row['ShipperID']);

 
	$this->SHIPPERS->setCompanyName($row['CompanyName']);

 
	$this->SHIPPERS->setPhone($row['Phone']);

 
}
return $this->SHIPPERS;
}

function insert($SHIPPERS){
	global $conn;
	$query = "insert into SHIPPERS(ShipperID,CompanyName,Phone) values('".$SHIPPERS->getShipperID()."','".$SHIPPERS->getCompanyName()."','".$SHIPPERS->getPhone()."')";
 
 $parse=mysql_query($query);

 }
 
 function findall(){
	$query = "select ShipperID,CompanyName,Phone from SHIPPERS";
	$parse=mysql_query($query);
	$datas = array();
	while($row=mysql_fetch_assoc($parse))
	{
		$data = array();$data['ShipperID'] = $row['ShipperID'];
		$data['CompanyName'] = $row['CompanyName'];
		$data['Phone'] = $row['Phone'];
		$datas[] = $data;
	 }
	return $datas;
	}
	function delete($SHIPPERS){
	$query = "delete from SHIPPERS where ShipperID= '".$SHIPPERS->getShipperID()."'";
	$parse=mysql_query($query);
	return $parse;

	}
	
	function update($SHIPPERS){
	$query = "update SHIPPERS set CompanyName= '".$SHIPPERS->getCompanyName()."',Phone= '".$SHIPPERS->getPhone()."' where ShipperID= '".$SHIPPERS->getShipperID()."'";
$parse=mysql_query($query);

}


}
 //include/SHIPPERS_session.php